package com.mhc.suzuki.api.service;


import com.mhc.suzuki.api.model.DataDictDTO;
import com.mhc.suzuki.exception.SuzukiCommonException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Created by HW
 * on 2017/8/15 18:16.
 */
@FeignClient("SUZUKI")
@RequestMapping("/feign/IDataDictService")
public interface IDataDictService {

    /**
     * 获取元数据分组列表
     * @param companyNo 公司编号
     * @return
     */
    @RequestMapping(value = {"/getDataGroupList"}, method = {RequestMethod.GET})
    List<DataDictDTO> getDataGroupList(@RequestParam("companyNo") String companyNo) throws SuzukiCommonException;

    /**
     * 查询公司下某分组下所有数据
     * @param dataGroupCode 分组code
     * @param companyNo 公司编号
     * @return
     * @throws Exception
     */
    @RequestMapping(value = {"/getGroupDataList2"}, method = {RequestMethod.GET})
    List<DataDictDTO> getGroupDataList(@RequestParam("dataGroupCode") String dataGroupCode,@RequestParam("companyNo") String companyNo) throws SuzukiCommonException;

    /**
     * 添加数据
     * @param dataDictDTO 添加的数据
     * @throws Exception
     */
    @RequestMapping(value = {"/addDataDict"}, method = {RequestMethod.POST})
    void addDataDict(@RequestBody DataDictDTO dataDictDTO) throws SuzukiCommonException;

    /**
     * 数据更新
     * @param dataDictDTO 更新数据
     * @throws Exception
     */
    @RequestMapping(value = {"/updateDict"}, method = {RequestMethod.POST})
    void updateDict(@RequestBody DataDictDTO dataDictDTO) throws SuzukiCommonException;

    /**
     * 数据删除
     * @param dataDictDTO 删除数据信息
     * @throws Exception
     */
    @RequestMapping(value = {"/deleteDataDict"}, method = {RequestMethod.POST})
    void deleteDataDict(@RequestBody DataDictDTO dataDictDTO) throws SuzukiCommonException;

    /**
     * 根据companyid, groupcode确定是否存在该分组
     * @param groupCode
     * @param companyNo
     * @return
     * @throws SuzukiCommonException
     */
    @RequestMapping(value = {"/getCodeGroupByGroupCodeAndCompanyId"}, method = {RequestMethod.GET})
    int getCodeGroupByGroupCodeAndCompanyId(@RequestParam("groupCode") String groupCode,@RequestParam("companyNo") String companyNo) throws SuzukiCommonException;

}
